def yanghui(n):
    triangle = []
    for i in range(n):
        row = []
        for j in range(i+1):
            if j == 0 or j == i:
                row.append(1)
            else:
                row.append(triangle[i-1][j-1] + triangle[i-1][j])
        triangle.append(row)
    # 打印杨辉三角
#   for row in triangle:
#        print(' '.join(str(num) for num in row).center(n*3))


def is_perfect_number(n):
    factors = [1]
    for i in range(2, int(n/2)+1):
        if n % i == 0:
            factors.append(i)
    return sum(factors) == n

def call_before(func):
    def wrapper(*args, **kwargs):
        print(f"正式调用{func.__name__}函数")
        return func(*args, **kwargs)
    return wrapper